//
//  PersonCenterTopInfo.m
//  BeautyPicture
//
//  Created by 沈振邦 on 15/8/11.
//  Copyright (c) 2015年 szb. All rights reserved.
//

#import "PersonCenterTopInfo.h"

@implementation PersonCenterTopInfo

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        CGFloat picX = 15.0f;
        CGFloat picW = frame.size.height - picX * 2.0;
        
        _userPic = [[UIImageView alloc] initWithFrame:CGRectMake(picX, picX, picW, picW)];
        _userPic.backgroundColor = [UIColor grayColor];
        [_userPic.layer setMasksToBounds:YES];
        [_userPic.layer setCornerRadius:picW / 2.0];
        [self addSubview:_userName];
        
        CGFloat btnX = CGRectGetMaxX(_userPic.frame) + 15.0f;
        CGFloat btnW = 65.0f;
        CGFloat btnH = 35.0f;
        CGFloat btnY = frame.size.height - 45.0f;
        
        _myProductBtn = [[personNumberBtn alloc] initWithFrame:CGRectMake(btnX, btnY, btnW, btnH)];
        _myProductBtn.textLabel.text = @"我的作品";
        
        [self addButton:_myProductBtn];
        
        _myOrderBtn = [[personNumberBtn alloc] initWithFrame:CGRectMake(btnX + btnW, btnY, btnW, btnH)];
        _myOrderBtn.textLabel.text = @"我的订单";
        [self addButton:_myOrderBtn];
        
        _myShareBtn = [[personNumberBtn alloc] initWithFrame:CGRectMake(btnX + btnW * 2.0f, btnY, btnW, btnH)];
        _myShareBtn.textLabel.text = @"我的分享";
        [self addButton:_myShareBtn];
        
        _userName = [[UILabel alloc] initWithFrame:CGRectMake(btnX + 10.0, picX, 200, 20.0f)];
        _userName.font = [UIFont systemFontOfSize:15.0f];
        
        _userNumber = [[UILabel alloc] initWithFrame:CGRectMake(btnX + 10.0, picX + 30, 200, 15.0f)];
        _userNumber.font = [UIFont systemFontOfSize:14.0f];
        
        for (int i = 0; i < 2; i++) {
            BPLineView *lineView = [[BPLineView alloc] initWithFrame:CGRectMake(btnX + btnW * (i+1), btnY, 1.0, btnH)];
            [self addSubview:lineView];
        }
        
        [self addSubview:_userName];
        [self addSubview:_userNumber];
        [self addSubview:_userPic];
    }
    return self;
}

- (void)setUpPersonInfo
{

}

- (void)addButton:(personNumberBtn *)Button
{
    Button.numberLabel.textAlignment = NSTextAlignmentCenter;
    Button.numberLabel.textColor = [UIColor blackColor];
    Button.numberLabel.font = [UIFont systemFontOfSize:17.0f];
    
    Button.textLabel.textAlignment = NSTextAlignmentCenter;
    Button.textLabel.textColor = [UIColor blackColor];
    Button.textLabel.font = [UIFont systemFontOfSize:13.0f];
    
    [self addSubview:Button];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
